from django.shortcuts import render,HttpResponse,redirect
from django.urls import reverse  #url别名反向解析的

# Create your views here.

def home(request):
    return render(request,'home.html')


def menu1(request):
    return render(request,'menu1.html')


def menu2(request):
    return render(request, 'menu2.html')


def menu3(request):
    return render(request, 'menu3.html')


def xx(request):
    return render(request,'xx.html')


def test(request):

    return render(request,'test.html',{'name':'冯强xx'})

def new(request):

    a = ['aa','bb','cc']
    return render(request,'new.html',{'a':a})


def index(request):

    return render(request,'index.html')


def login(request):


    if request.method == 'GET':
        print(reverse('index'))  #/index2/
        print(reverse('home'))  #/home2/
        return render(request,'login.html')

    else:
        username = request.POST.get('uname')
        password = request.POST.get('pwd')
        if username == 'liye' and password == 'dsb':
            return redirect('index') #reverse('index')

        else:
            return HttpResponse('gunduzi!')





